package com.gimi.cloud.bbp.client.controller.moreInfo;

import javax.servlet.http.HttpServletResponse;

import com.gimi.cloud.bbp.client.service.moreInfo.CreditcardBankcodeService;
import com.gimi.cloud.bbp.common.utils.reqhead.Response;
import com.gimi.cloud.bbp.common.utils.reqhead.Util;
import com.gimi.cloud.bbp.dto.app.moreInfo.CreditcardBankcodeDTO;
import com.gimi.cloud.bbp.dto.app.moreInfo.CreditcardLoginDTO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSON;


/**
 * 蜂巢信用卡相关服务
 */
@RestController
@RequestMapping(value = "/moreInfo")
public class CreditcardBankcodeController {

	private static final Logger log = LoggerFactory.getLogger(CreditcardBankcodeController.class);

	private CreditcardBankcodeService creditcardBankcodeService;
    @Autowired
	public CreditcardBankcodeController(CreditcardBankcodeService creditcardBankcodeService) {
		this.creditcardBankcodeService = creditcardBankcodeService;
	}

	/**
	 * 获取支持银行列表
	 * @param creditcardBankcodeDTO
	 * @param response
	 */
	@RequestMapping(value = "/getSupportedCreditcardBanks")
	public void getSupportedCreditcardBanks(@RequestBody CreditcardBankcodeDTO creditcardBankcodeDTO, HttpServletResponse response){
		log.info("获取支持银行列表,入参"+creditcardBankcodeDTO);
		Response responsedata = creditcardBankcodeService.getSupportedCreditcardBanks(creditcardBankcodeDTO);
		Util.sendResponse(JSON.toJSONString(responsedata), response);
	}
	
	/**
	 * 获取银行登陆参数
	 * @param creditcardBankcodeDTO
	 * @param response
	 */
	@RequestMapping(value = "/getCreditcardLoginParameter")
	public void getCreditcardLoginParameter(@RequestBody CreditcardBankcodeDTO creditcardBankcodeDTO, HttpServletResponse response){
		log.info("获取银行登陆参数,入参"+creditcardBankcodeDTO);
		Response responsedata = creditcardBankcodeService.getCreditcardLoginParameter(creditcardBankcodeDTO);
		Util.sendResponse(JSON.toJSONString(responsedata), response);
	}
	
	/**
	 * 提交基本登录参数
	 * @param creditcardLoginDTO
	 * @param response
	 */
	@RequestMapping(value = "/subCreditcardBasicParam")
	public void subCreditcardBasicParam(@RequestBody CreditcardLoginDTO creditcardLoginDTO, HttpServletResponse response){
		log.info("提交基本登录参数,入参"+creditcardLoginDTO);
		Response responsedata = creditcardBankcodeService.subCreditcardBasicParam(creditcardLoginDTO);
		Util.sendResponse(JSON.toJSONString(responsedata), response);
	}
}
